/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.client.geoviewer.edit;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import org.netbeans.api.visual.widget.Scene;
import org.netbeans.api.visual.widget.Widget;

/**
 *
 * @author Timon Veenstra
 */
public class GeoNodeWidget extends Widget {

    private final GeoNode geoNode;
    private static final int WIDTH = 20;
    private static final int HEIGHT = 20;
    private static final int THICKNESS = 4;

    public GeoNodeWidget(Scene scene, GeoNode geoNode) {
        super(scene);
        this.geoNode = geoNode;
        setPreferredSize(new Dimension(WIDTH, HEIGHT));
        setBorder(BorderFactory.createLineBorder(Color.RED, THICKNESS));
        setToolTipText(geoNode.toString());
    }

    public GeoNode getGeoNode() {
        return geoNode;
    }

    @Override
    protected void paintWidget() {
        super.paintWidget();
        Graphics g = getGraphics().create();
        g.setColor(Color.RED);
        g.fill3DRect(4, 4, 4, 4, true);
        g.dispose();
    }
}
